# -*- coding:UTF-8 -*-
import requests
from bs4 import BeautifulSoup

if __name__ == '__main__':
    url = r'https://book.qidian.com/ajax/book/category?_csrfToken=tEkAsBoC4GiVEVSmerpT3Yy6qAqaweceg80uNXvp&bookId=1735921'
    headers = {
        'User-Agent':
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36'
    }
    # req = requests.get(url=url, headers=headers)
    req = requests.get(url=url)
    html = req.text
    div_bf = BeautifulSoup(html, "html.parser")
    div = div_bf.find_all('div', class_='catalog-content-wrap')
    print(type(div))
    # try:
    #     with open('遮天目录.txt', 'w+', encoding='utf-8') as file:
    #         file.write(str(div[0]))
    # except Exception as e:
    #     print(e)
